---
title: 'revoke'
description: 'Revoke an api key'
---

Pass the optional and required parameters as per the official [API docs](https://unkey.com/docs/api-reference/apis/list-keys). See the DTO reference below for more information.

```java
package com.example.myapp;

import com.unkey.unkeysdk.dto.KeyDeleteRequest;

@RestController
public class APIController {

    private static IKeyService keyService = new KeyService();

    @DeleteMapping("/delete")
    public ResponseEntity<String> updateKey(
            @RequestBody KeyDeleteRequest keyId,
            @RequestHeader("Authorization") String authToken) {
        // Delegate the creation of the key to the KeyService
        return keyService.deleteKey(authToken, keyId);
    }
}

```

### DTOs Reference

The DTOs used in the code for a better understanding of request and response bodies.

#### Request

```java
public class KeyDeleteRequest {
    private String keyId;
}
```

#### Response

"OK"
